#screen {
    width: 450px;
    height: 50px;
    margin-top: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 22px;
    line-height: 50px;
    text-align: center;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    font-weight: bold;
}

#chat_area {
    width: 404px;
    height: 400px;
    margin-top: 10px;
    margin-left: 150px;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    position: relative;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

#chat_show {
    width: 100%;
    height: 300px;
    padding: 15px;
    overflow-y: auto;
    background: white;
    border-radius: 10px 10px 0 0;
    font-size: 16px;
    line-height: 1.4;
    scrollbar-width: thin;
    scrollbar-color: #c3cfe2 #f5f7fa;
    /* 确保滚动平滑 */
    scroll-behavior: smooth;
}

/* 自定义滚动条 */
#chat_show::-webkit-scrollbar {
    width: 6px;
}

#chat_show::-webkit-scrollbar-track {
    background: #f5f7fa;
    border-radius: 3px;
}

#chat_show::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px;
}

#chat_show::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

#msg_show {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 15px 15px;
    display: flex;
    gap: 10px;
    align-items: center;
}

#chat_input {
    flex: 1;
    height: 45px;
    padding: 0 15px;
    background: #f8f9fa;
    font-size: 16px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    outline: none;
    transition: all 0.3s ease;
}

#chat_input:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#chat_button {
    width: 80px;
    height: 45px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 14px;
    font-weight: bold;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#chat_button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

#chat_button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.4);
}

#chat_button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 消息样式美化 */
#self_msg {
    max-width: 70%;
    padding: 12px 18px;
    margin: 8px 0;
    line-height: 1.4;
    font-size: 14px;
    float: right;
    clear: both;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px 20px 5px 20px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    position: relative;
    word-wrap: break-word;
}

#self_msg::before {
    content: '';
    position: absolute;
    bottom: -2px;
    right: -5px;
    width: 10px;
    height: 10px;
    background: inherit;
    clip-path: polygon(0 0, 100% 0, 100% 100%);
}

#peer_msg {
    max-width: 70%;
    padding: 12px 18px;
    margin: 8px 0;
    line-height: 1.4;
    font-size: 14px;
    float: left;
    clear: both;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border-radius: 20px 20px 20px 5px;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
    position: relative;
    word-wrap: break-word;
}

#peer_msg::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: -5px;
    width: 10px;
    height: 10px;
    background: inherit;
    clip-path: polygon(0 0, 0 100%, 100% 0);
}

/* 消息时间戳样式 */
.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
    display: block;
}

/* 玩家信息样式 */
#player_info {
    margin: 10px 0;
    padding: 12px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 10px;
    text-align: center;
    font-weight: bold;
    font-size: 16px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.white-player {
    color: #333;
    background: linear-gradient(135deg, #D1D1D1 0%, #F9F9F9 100%);
    padding: 6px 12px;
    border-radius: 20px;
    border: 2px solid #b8b8b8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.black-player {
    color: white;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    padding: 6px 12px;
    border-radius: 20px;
    border: 2px solid #2c3e50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* 状态样式 */
.my-turn {
    color: #1890ff;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(24, 144, 255, 0.3);
}

.opponent-turn {
    color: #666;
    font-weight: bold;
}

.win-message {
    color: #52c41a;
    font-weight: bold;
    font-size: 18px;
    text-shadow: 0 2px 4px rgba(82, 196, 26, 0.3);
}

.lose-message {
    color: #ff4d4f;
    font-weight: bold;
    font-size: 18px;
    text-shadow: 0 2px 4px rgba(255, 77, 79, 0.3);
}

.back-button {
    margin: 10px auto;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    text-align: center;
    width: 140px;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.back-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

#color_example {
    display: block;
    margin: 8px auto;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 游戏结束时的棋盘样式 */
#chess.disabled {
    pointer-events: none;
    opacity: 0.7;
    cursor: not-allowed;
    filter: grayscale(0.3);
}

/* 响应式设计 */
@media (max-width: 768px) {
    #chat_area {
        margin-left: 0;
        width: 100%;
        max-width: 400px;
    }
    
    #self_msg, #peer_msg {
        max-width: 85%;
    }
}

/* 动画效果 */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#self_msg, #peer_msg {
    animation: messageSlideIn 0.3s ease-out;
}

